<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简易li上下循环</title>
    <link rel="shortcut icon" href="../lib/image/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="../lib/css/all.css">
    <script src="../lib/js/jquery-3.3.1.min.js"></script>
</head>
<style>
    :root {
        --h: 36;
        --speed: 1.5s;
    }

    @keyframes liMove {
        0% {
            transform: translate(0, 0);
        }

        80%,
        100% {
            transform: translate(0, -36px);
        }
    }

    .g-container {
        width: 300px;
    }

    ul {
        display: flex;
        flex-direction: column;
        margin: 0px;
        animation: move calc(var(--speed) * var(--s)) steps(var(--s)) infinite;
    }

    ul li {
        width: 100%;
        height: 36px;
        animation: liMove calc(var(--speed)) infinite;
    }

    @keyframes move {
        0% {
            transform: translate(0, 0);
        }

        100% {
            transform: translate(0, calc(var(--s) * var(--h) * -1px));
        }
    }

    @keyframes liMove {
        0% {
            transform: translate(0, 0);
        }

        80%,
        100% {
            transform: translate(0, calc(var(--h) * -1px));
        }
    }
</style>

<body>
    <div id="app">
        <div style="width: 260px;height: 180px;overflow: hidden;">
            <div class="g-container">
                <ul class="ul_c" style="--s: 1;">
                    <li>Lorem ipsum 1111111</li>
                    <li>Lorem ipsum 2222222</li>
                    <li>Lorem ipsum 3333333</li>
                    <li>Lorem ipsum 4444444</li>
                    <li>Lorem ipsum 5555555</li>
                    <li>Lorem ipsum 6666666</li>
                    <li>Lorem ipsum 7777777</li>
                    <li>Lorem ipsum 8888888</li>
                    <li>Lorem ipsum 9999999</li>
                    <li>Lorem ipsum 1111111</li>
                    <li>Lorem ipsum 2222222</li>
                    <li>Lorem ipsum 3333333</li>
                    <li>Lorem ipsum 4444444</li>
                    <li>Lorem ipsum 5555555</li>
                    <li>Lorem ipsum 6666666</li>
                    <li>Lorem ipsum 7777777</li>
                    <li>Lorem ipsum 8888888</li>
                    <li>Lorem ipsum 9999999</li>
                </ul>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(".ul_c").css("--s", "9")
    </script>
</body>

</html>